﻿using M.ShopMachine.Repository.Interface;
using M.ShopMachine.Write.WebApi.Application.Command.PatrolCommand;
using MediatR;

namespace M.ShopMachine.Write.WebApi.Application.Handler.PatrolHandler
{
    public class AddPatrolHandler : IRequestHandler<AddPatrolCommand, int>
    {
        private readonly IPatrolRepository patrolRepository;

        public AddPatrolHandler(IPatrolRepository patrolRepository)
        {
            this.patrolRepository = patrolRepository;
        }

        public async Task<int> Handle(AddPatrolCommand request, CancellationToken cancellationToken)
        {
            return await patrolRepository.AddPatrolAsync(request);
        }
    }
}
